import random


def recommend_clothes(weather):
    """
    根据天气情况推荐10件衣服
    :param weather: dict, 包含天气信息，如风强、温度、天气情况
    :return: list, 推荐的衣服列表
    """
    temperature = int(weather.day_temp)  # 温度
    weather_condition = weather.day_weather  # 天气情况

    # 定义不同天气情况下的衣服权重
    if "晴" in weather_condition:
        if temperature > 25:
            # 热天晴天：短袖、短裤、短裙
            clothes_weights = {
                "短袖": 30,
                "短裤": 25,
                "短裙": 25,
                "长裤": 10,
                "长裙": 10,
                "长袖": 0
            }
        elif 10 <= temperature <= 25:
            clothes_weights = {
                "短袖": 20,
                "短裤": 15,
                "短裙": 15,
                "长袖": 20,
                "长裤": 15,
                "长裙": 15
            }
        else:
            # 冷天晴天：长袖、长裤、长裙
            clothes_weights = {
                "长袖": 30,
                "长裤": 30,
                "长裙": 20,
                "短袖": 0,
                "短裤": 0,
                "短裙": 0
            }
    elif "云" in weather_condition or "阴" in weather_condition:
        if temperature > 20:
            # 温暖多云/阴天：长袖、短袖、长裤、短裤、长裙、短裙
            clothes_weights = {
                "短袖": 20,
                "短裤": 15,
                "短裙": 15,
                "长袖": 20,
                "长裤": 15,
                "长裙": 15
            }
        else:
            # 凉爽多云/阴天：长袖、长裤、长裙
            clothes_weights = {
                "长袖": 30,
                "长裤": 30,
                "长裙": 20,
                "短袖": 0,
                "短裤": 0,
                "短裙": 0
            }
    elif "雨" in weather_condition or "雪" in weather_condition:
        # 雨天：长袖、长裤、长裙
        clothes_weights = {
            "长袖": 30,
            "长裤": 30,
            "长裙": 20,
            "短袖": 0,
            "短裤": 0,
            "短裙": 0
        }
    else:
        # 其他天气情况：默认推荐通用衣服
        clothes_weights = {
            "短袖": 20,
            "短裤": 15,
            "短裙": 15,
            "长袖": 20,
            "长裤": 15,
            "长裙": 15
        }

    total_weight = sum(clothes_weights.values())
    weights = [weight / total_weight for weight in clothes_weights.values()]
    clothes = list(clothes_weights.keys())
    selected_clothes = random.choices(clothes, weights=weights, k=5)

    return selected_clothes

